﻿using System;
using System.Collections;
using System.Collections.Generic;
using TrueSync;
using Framework;

public enum StimulateTypeEnum
{
    NoStimulate,
    HitFloatStimulate,
    FalldownStimulate,
    HitFlyStimulate,
    HitBackStimulate,
    ThrowStimulate,
    BeCounterAttackStimulate,
}

public abstract class Stimulate
{
    public bool HasUpStimulate;
    public bool HasDownStimulate;

    public abstract StimulateTypeEnum StimulateType
    {
        get;
    }

    public abstract void Serialize(EByte ms);

    public abstract void Deserialize(EByte ms);
}

public class NoStimulate : Stimulate
{
    public override StimulateTypeEnum StimulateType
    {
        get
        {
            return StimulateTypeEnum.NoStimulate;
        }
    }

    public override void Deserialize(EByte ms)
    {
    }

    public override void Serialize(EByte ms)
    {
    }
}

public class HitBackStimulate : Stimulate
{
    public FP XMoveLength;
    public FP XMoveSpeed;

    public override StimulateTypeEnum StimulateType
    {
        get
        {
            return StimulateTypeEnum.HitBackStimulate; 
        }
    }

    public override void Deserialize(EByte ms)
    {
        XMoveLength = FP.FromRaw(ms.ReadLong());
        XMoveSpeed = FP.FromRaw(ms.ReadLong());
    }
    
    public override void Serialize(EByte ms)
    {
        ms.WriteLong(XMoveLength.RawValue);
        ms.WriteLong(XMoveSpeed.RawValue);
    }
}

public class HitFlyStimulate : Stimulate//吹飞激励
{
    public FP XMoveLength;
    public FP XMoveSpeed;

    public override StimulateTypeEnum StimulateType
    {
        get
        {
            return StimulateTypeEnum.HitFlyStimulate;
        }
    }

    public override void Deserialize(EByte ms)
    {
        XMoveLength = FP.FromRaw(ms.ReadLong());
        XMoveSpeed = FP.FromRaw(ms.ReadLong());
    }


    public override void Serialize(EByte ms)
    {
        ms.WriteLong(XMoveLength.RawValue);
        ms.WriteLong(XMoveSpeed.RawValue);
    }
}


public class HitFloatStimulate : Stimulate
{
    public FP XMoveLength;
    public FP XMoveSpeed;
    public FP YHeight;

    public override StimulateTypeEnum StimulateType
    {
        get
        {
            return StimulateTypeEnum.HitFloatStimulate;
        }
    }

    public override void Deserialize(EByte ms)
    {
        XMoveLength = FP.FromRaw(ms.ReadLong());
        XMoveSpeed = FP.FromRaw(ms.ReadLong());
        YHeight = FP.FromRaw(ms.ReadLong());
    }

    public override void Serialize(EByte ms)
    {
        ms.WriteLong(XMoveLength.RawValue);
        ms.WriteLong(XMoveSpeed.RawValue);
        ms.WriteLong(YHeight.RawValue);
    }
}

public class FalldownStimulate : Stimulate
{
    public override StimulateTypeEnum StimulateType
    {
        get
        {
            return StimulateTypeEnum.FalldownStimulate; 
        }
    }

    public override void Deserialize(EByte ms)
    {
    }

    public override void Serialize(EByte ms)
    {
    }
}

public class ThrowStimulate : Stimulate
{
    public override StimulateTypeEnum StimulateType
    {
        get
        {
            return StimulateTypeEnum.ThrowStimulate;
        }
    }

    public override void Deserialize(EByte ms)
    {
    }

    public override void Serialize(EByte ms)
    {
    }
}

public class BeCounterAttackedStimulate : Stimulate
{
    public override StimulateTypeEnum StimulateType
    {
        get
        {
            return StimulateTypeEnum.BeCounterAttackStimulate;
        }
    }

    public override void Deserialize(EByte ms)
    {
    }

    public override void Serialize(EByte ms)
    {
    }
}
